package hu.issue.web;

import hu.issue.ejb.ProjectService;
import hu.issue.entity.Project;
import hu.issue.framework.web.Constants;
import hu.issue.framework.web.controller.Inject;
import hu.issue.framework.web.controller.RequiredRole;
import hu.issue.framework.web.controller.SimpleController;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@RequiredRole(Constants.ROLE_USER)
public class DashboardController extends SimpleController {
	@Inject
	private ProjectService projectService;

	@Override
	public void handleRequestInternal(final HttpServletRequest request, final HttpServletResponse response) throws Exception {
		final List<Project> projects = this.projectService.getProjects();
		request.setAttribute("projects", projects);
		request.setAttribute("title", "Dashboard");
	}
}
